package com.qf.commerce.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qf.commerce.common.dto.OrderListDto;
import com.qf.commerce.common.vo.OrderListVo;
import com.qf.commerce.entity.Address;
import com.qf.commerce.entity.OrderList;
import com.qf.commerce.mapper.OrderListMapper;
import com.qf.commerce.service.OrderListService;
import com.qf.commerce.utils.CommonBeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import java.util.List;

/**
 * 订单状态详情
 * 出品人:lsj
 * 1992915043@qq
 */
@Service
public class OrderListServiceImpl implements OrderListService {

    @Autowired
    private OrderListMapper orderListMapper;
    @Override
    public OrderList getOrderListByOrderStatus(Integer orderStatus) {
        return orderListMapper.selectByOrderStatus(orderStatus);
    }

    @Override
    public List<OrderList> getInquiryByOrderStatus(Integer orderStatus) {
        return  orderListMapper.selectInquiryByOrderStatus(orderStatus);
    }

    @Override
    public List<OrderList> getDepositPendingByOrderStatus(Integer orderStatus) {
        return orderListMapper.selectDepositPendingByOrderStatus(orderStatus);
    }

    @Override
    public List<OrderList> getBalancePaymentByOrderStatusOrderStatus(Integer orderStatus) {
        return orderListMapper.selectBalancePaymentByOrderStatus(orderStatus);
    }

    @Override
    public List<OrderList> getBalancePaidByOrderStatusByOrderStatusOrderStatus(Integer orderStatus) {
        return orderListMapper.selectBalancePaidByOrderStatus(orderStatus);
    }

    @Override
    public List<OrderList> getAwaitReceiveGoodsByOrderStatus(Integer orderStatus) {
        return orderListMapper.selectAwaitReceiveGoodsByOrderStatus(orderStatus);
    }

    @Override
    public List<OrderList> getOpenMultiphaseByOrderStatus(Integer orderStatus) {
        return orderListMapper.selectOpenMultiphaseByOrderStatus(orderStatus);
    }

    @Override
    public List<OrderList> getMultistageDeliveryByOrderStatus(Integer orderStatus) {
        return orderListMapper.selectMultistageDeliveryByOrderStatus(orderStatus);
    }

    @Override
    public List<OrderList> getAwaitReceiveGoodByOrderStatus(Integer orderStatus) {
        return orderListMapper.selectAwaitReceiveGoodByOrderStatus(orderStatus);
    }

    @Override
    public List<OrderList> getCompleteOrderByOrderStatusByOrderStatus(Integer orderStatus) {
        return orderListMapper.selectCompleteOrderByOrderStatus(orderStatus);
    }

    @Override
    public List<OrderList> getRemainEevaluatedByOrderStatus(Integer orderStatus) {
        return orderListMapper.selectRemainEevaluatedByOrderStatus(orderStatus);
    }

    @Override
    public List<OrderList> getCancelledOrderByOrderStatus(Integer orderStatus) {
        return orderListMapper.selectCancelledOrderByOrderStatus(orderStatus);
    }

    @Override
    public PageInfo<OrderListVo> getOrderPageByOrderList(OrderListDto orderListDto, Integer page, Integer size) {
        return CommonBeanUtils.copyPage(PageHelper.startPage(page,size).
                doSelectPageInfo(()->orderListMapper.selectOrderPageByOrderList(orderListDto)),
                new PageInfo<OrderListVo>(),OrderListVo::new);
    }

    @Override
    public int deleteOrderList(List<Long> orderId) {
        return orderListMapper.deleteByOrderId(orderId);
    }

    @Override
    public int getUpdateOrderList(Address address) {
        return orderListMapper.updateByOrderStatus(address);

    }


}
